In a multi protocol label switching (Multi Protocol Label Switching, MPLS) network, a label distribution protocol (Label Distribution Protocol, LDP) session needs to be set up between different label forwarding routers (Label Switched Router, LSR) to exchange messages such as a label mapping message and a release message, so as to set up a label switching path (Label Switching Path, LSP) is between different LSRs. A TCP connection is set up between two LSRs to transmit LDP messages.
In network applications of the prior art, the next-generation Internet Protocol (Internet Protocol version 6, IPv6), thanks to its larger address space and other advantages, is gradually replacing the conventional IPV4 protocol; however, IPV6 still needs continuous development and improvement, and will coexist with IPv4 for a long time in actual applications, namely, a dual-stack network. In a dual-stack network scenario, when a TCP connection is set up to implement an LDP session, one LSR has an IPV4 address family and an IPV6 address family, and can use the IPV4 address family or the IPV6 address family to set up the TCP connection. In this case, it is possible that the address families selected by two LSRs are inconsistent. For example, when one LSR selects the IPV4 address family to request to set up a TCP connection, but the other corresponding LSR selects the IPV6 address family to set up a TCP connection, the two address families are inconsistent, which inevitably results in an LDP session setup failure.
However, a policy used in the existing dual-stack network scenario does not allow switching between address families, that is, an LSR always attempts to set up a TCP connection by using an address family selected by the LSR without any change, which causes a deadlock of an LDP session, that is, an LDP session connection may fail to be initiated normally due to inconsistency of address families.